package com.nw.news.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Date;

/**
 * 直播
 */
public class Live implements Parcelable {
	private int id;
	private String title;
	private String content;
	private Date publishDate;// 预约的直播时间
	private int gradeId;// 直播的班级
	private String liveChannel;// 直播通道
	private String schoolName;// 视频信息中显示的学校名称
	private String classroom;// 教室
	private String course;// 课程
	private String url;// 直播地址，后台审核后可见
	private String targetParents;// 目标家长（以英文逗号“,”分隔）
	private String targetChannels;// 目标群组（以英文逗号“,”分隔）
	private String targetGrades;// 目标班级（以英文逗号“,”分隔）
	private boolean authorized;// 需要园长审核
	private boolean checked;// 需要后台审核
	private String requester;// 发布者用户名
	private int schoolId;// 学校

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getPublishDate() {
		return publishDate;
	}

	public void setPublishDate(Date publishDate) {
		this.publishDate = publishDate;
	}

	public int getGradeId() {
		return gradeId;
	}

	public void setGradeId(int gradeId) {
		this.gradeId = gradeId;
	}

	public String getLiveChannel() {
		return liveChannel;
	}

	public void setLiveChannel(String liveChannel) {
		this.liveChannel = liveChannel;
	}

	public String getSchoolName() {
		return schoolName;
	}

	public void setSchoolName(String schoolName) {
		this.schoolName = schoolName;
	}

	public String getClassroom() {
		return classroom;
	}

	public void setClassroom(String classroom) {
		this.classroom = classroom;
	}

	public String getCourse() {
		return course;
	}

	public void setCourse(String course) {
		this.course = course;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getTargetParents() {
		return targetParents;
	}

	public void setTargetParents(String targetParents) {
		this.targetParents = targetParents;
	}

	public String getTargetChannels() {
		return targetChannels;
	}

	public void setTargetChannels(String targetChannels) {
		this.targetChannels = targetChannels;
	}

	public String getTargetGrades() {
		return targetGrades;
	}

	public void setTargetGrades(String targetGrades) {
		this.targetGrades = targetGrades;
	}

	public boolean isAuthorized() {
		return authorized;
	}

	public void setAuthorized(boolean authorized) {
		this.authorized = authorized;
	}

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public String getRequester() {
		return requester;
	}

	public void setRequester(String requester) {
		this.requester = requester;
	}

	public int getSchoolId() {
		return schoolId;
	}

	public void setSchoolId(int schoolId) {
		this.schoolId = schoolId;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(this.id);
		dest.writeString(this.title);
		dest.writeString(this.content);
		dest.writeLong(this.publishDate != null ? this.publishDate.getTime() : -1);
		dest.writeInt(this.gradeId);
		dest.writeString(this.liveChannel);
		dest.writeString(this.schoolName);
		dest.writeString(this.classroom);
		dest.writeString(this.course);
		dest.writeString(this.url);
		dest.writeString(this.targetParents);
		dest.writeString(this.targetChannels);
		dest.writeString(this.targetGrades);
		dest.writeByte(this.authorized ? (byte) 1 : (byte) 0);
		dest.writeByte(this.checked ? (byte) 1 : (byte) 0);
		dest.writeString(this.requester);
		dest.writeInt(this.schoolId);
	}

	public Live() {
	}

	protected Live(Parcel in) {
		this.id = in.readInt();
		this.title = in.readString();
		this.content = in.readString();
		long tmpPublishDate = in.readLong();
		this.publishDate = tmpPublishDate == -1 ? null : new Date(tmpPublishDate);
		this.gradeId = in.readInt();
		this.liveChannel = in.readString();
		this.schoolName = in.readString();
		this.classroom = in.readString();
		this.course = in.readString();
		this.url = in.readString();
		this.targetParents = in.readString();
		this.targetChannels = in.readString();
		this.targetGrades = in.readString();
		this.authorized = in.readByte() != 0;
		this.checked = in.readByte() != 0;
		this.requester = in.readString();
		this.schoolId = in.readInt();
	}

	public static final Creator<Live> CREATOR = new Creator<Live>() {
		@Override
		public Live createFromParcel(Parcel source) {
			return new Live(source);
		}

		@Override
		public Live[] newArray(int size) {
			return new Live[size];
		}
	};
}
